import java.util.Scanner;

public class GussNumber {
    public static void main(String[] args) {
        while (true){
            int answer=(int)(Math.random()*100)+1;
            int guss=0;
            System.out.println("请输入一个1-100之间的数字：");
            Scanner scan=new Scanner(System.in);
            int times=0;
            while (times<7){
                guss=scan.nextInt();
                times=times+1;
                if (guss<answer){
                    System.out.println("小了");
                }else if (guss>answer){
                    System.out.println("大了");
                }else {
                    System.out.println("答对了恭喜你!");
                    break;
                }
            }
            if (times==7&&answer!=guss){
                System.out.println("猜错了，继续努力");
            }
            System.out.println("是否还要和我试一试？(y/n)");
            String choice =scan.next();
            if (!choice.equalsIgnoreCase("y")){
                break;
            }
        }

    }
}
